define(function() {

	return {
		loadState : {
			NOT_LOADED 	: 0,
			LOADING		: 1,
			LOADED		: 2
		},
		
		create : function(path) {
		
			var _count 		= 0;
			var _path		= path;
			var _loadState	= this.loadState;
		
			return {
				loadState : _loadState.NOT_LOADED,
			
				incRef : function(callback, params) {
					if(!callback)
						callback = function(){};
						
					if(++_count == 1 && this.loadState == _loadState.NOT_LOADED) {
						this.load(callback, params);
					} else if(this.loadState == _loadState.LOADED) {
						callback(this, params);
					}
				},
				
				decRef : function() {
					if(--_count == 0 && this.loadState == _loadState.LOADED) {
						this.unload();
					}
				},
				
				getPath : function() { return _path; },
				
				isLoaded : function() { return this.loadState === _loadState.LOADED; }
			};
		},
	};
});